﻿using System.Net.Http;

namespace UpdateApp.Config
{
    /// <summary>
    /// 版本获取
    /// </summary>
    internal class VersionDto
    {
        /// <summary>
        /// 应用唯一标识
        /// </summary>
        public string? AppKey { get; set; }

        /// <summary>
        /// 应用版本号，例如:10.11.0.2
        /// </summary>
        public string? Version { get; set; } = "0.0.0";

        /// <summary>
        /// 更新下载链接
        /// </summary>
        public string? UpdateUrl { get; set; }

        /// <summary>
        /// 待更新程序名称，带后缀；比如: eson.exe
		/// 待更新程序必须与此更新程序同一路径，切记
        /// </summary>
        public string? UpdateApp { get; set; }

        /// <summary>
        /// 更新请求方式，只支持POST、GET；默认为GET
        /// </summary>
        public string? UpdateMethod { get; set; }

        /// <summary>
        /// 更新请求方式，只支持POST、GET；默认为GET
        /// </summary>
        public HttpMethod HttpMethod => UpdateMethod?.ToUpperInvariant() == "POST" ? HttpMethod.Post : HttpMethod.Get;
    }
}
